package com.cattsoft.util.web;

import javax.servlet.ServletContext;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class AisContext {
	private static ServletContext servletContext;

	public static ServletContext getServletContext() {
		return servletContext;
	}

	public static void setServletContext(ServletContext sct) {
		servletContext = sct;
	}

	public static Object getObjectByIoc(String oname) {
		WebApplicationContext context = WebApplicationContextUtils
				.getWebApplicationContext(AisContext.getServletContext());
		return context.getBean(oname);
	}
}
